from lxml import etree
html = etree.parse('./test.html',etree.HTMLParser())
print(html)
# 所有节点
result = html.xpath('//*')
print(result)
print("***********")
# 所有li节点
result = html.xpath('//li')
print(result)
print(result[0])
# li下面的a节点
result = html.xpath('//li/a')
print(result)
# ul下面的a借点
result = html.xpath('//ul//a')
print(result)